Install Haskell in Linux/Mint
sudo apt-get install haskell-platform
Hello World
GDEV guoliangDev # ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> putStrLn "hello, world"
hello, world
Simple Function
Prelude> let sayHi name=putStrLn("Hi " ++ name) Prelude> sayHi "Li" Hi Li
Put the function into .hs file
example: main = putStrLn(“hello World!”)
Compile & execute :
GDEV helloWorld # vi sayHi.hs GDEV helloWorld # ghc -o sayHi sayHi.hs [1 of 1] Compiling Main ( sayHi.hs, sayHi.o ) Linking sayHi ... GDEV helloWorld # ./sayHi hello World!
How to quit/exit ghci?
Prelude> :quit Leaving GHCi.
Links
Input and Output: http://learnyouahaskell.com/input-and-output Haskell in 5 steps: http://www.haskell.org/haskellwiki/Haskell_in_5_stepsAyutthaya 大城游记 <->
// Proudly powered by Apache, PHP, MySQL, WordPress, Bootstrap, etc,.